<template>
	<view class="ylList">
		<navigator class="item" v-for="dt in lists" :key="dt._id" :url="`/pages/qa/reply?id=${dt._id}`">
			<view class="teacher">
				<view class="avatar">
					<cm-image :src="dt.userId.avatar"/>
				</view>
				<view class="name">{{dt.userId.nickname}}</view>
				<view class="tips"><!-- {{dt.teacher.industry}} | {{dt.teacher.jobs}} --></view>
				<view class="status" v-if="dt.transferList.length>0">
					由 {{dt.transferList[dt.transferList.length-1].name}} 专家回复
				</view>
			</view>
			<view class="wtmsbox">
				客户姓名：{{dt.userId.name}}（{{dt.userId.phone}}）
			</view>
			<view class="wtmsbox">
				问题描述：{{dt.questionContent}}
			</view>
			<view class="tmprbox">
				<view class="time">{{dateFormat('Y-m-d H:i:s',dt.createTime)}}</view>
				<view class="price" v-if="dt.customBidPrice">￥<text class="bp">{{dt.customBidPrice}}</text></view>
			</view>
			<view class="wtmsbox" v-if="dt.transferList.length>0" style="color: #999;">
				我求助于<text class="qiuz">{{dt.transferList[dt.transferList.length-1].name}}</text>专家
			</view>
		</navigator>
	</view>
</template>

<script>
	import {defineComponent,reactive,toRefs,onMounted,getCurrentInstance,computed} from 'vue'
	import {onLoad,onShow} from '@dcloudio/uni-app'
	import { useStore } from 'vuex'
	import {serviceOver} from "@/api/consult.js"
	import bodyWrap from "@/components/bodyWrap/index.vue"
	import cmImage from "@/components/cmImage/index.vue" 
	import {toast,dateFormat,serviceStatus,compareTime} from "@/utils/common.js"
	export default defineComponent({
		components:{
			bodyWrap,
			cmImage
		},
		props:{
			lists:Array,
			type:{
				type:Number,
				default:1
			}
		},
		setup(props,context) {
			const store = useStore()
			const {proxy} = getCurrentInstance()
			
			const state = reactive({
				userInfo:computed(()=>store.state.base.userInfo),
			})
			
			onMounted(()=>{
				
			})
			
			const goMeeting = (item)=>{
				//其中xxxxxxxxx为会议号，m%3D为固定写法，会议号前面不可留空格。
				wx.navigateToMiniProgram({
				        appId: 'wx33fd6cdc62520063', // 要跳转的微信小程序appid
				        path: `pages/sub-preMeeting/join-meeting/join-meeting?scene=m%3D${item.meeting_code}`, // 要跳转到的页面路径
				        success() {},
				        fail() {}
				});
			}
			
			const goHelp = (o)=>{
				uni.showModal({
					title: '提示',
					confirmText:'确认',
					content: `确认发起求助吗？确认后，问题将指派给其他专家，并由其进行回复！`,
					success: async (res)=> {
						if(res.confirm) {
							uni.navigateTo({
								url:'/pages/home/teacher/helpSelectTeacher/index?qid='+o._id
							})
						} else if (res.cancel) {
							
						}
					}
				});
			}
			
			return {
				...toRefs(state),
				dateFormat,
				goMeeting,
				serviceStatus,
				compareTime,
				goHelp
			}
		}
	})
</script>

<style lang="scss" scoped>
	.ylList{
		padding: 0 20rpx 20rpx 20rpx;
		.item{
			display: block;
			background: #fff;
			padding: 20rpx;
			margin: 20rpx 0 0 0;
			.teacher{
				display: flex;
				.avatar{
					width: 60rpx;
					height: 60rpx;
					border-radius: 50%;
					overflow: hidden;
					flex-shrink: 0;
				}
				.name{
					display: flex;
					align-items: center;
					font-size: 28rpx;
					font-weight: 700;
					padding: 0 0 0 10rpx;
					flex-shrink: 0;
				}
				.tips{
					display: flex;
					align-items: center;
					font-size: 26rpx;
					color: #999;
					padding: 0 0 0 10rpx;
					flex-shrink: 0;
					flex: 1;
				}
				.status{
					display: flex;
					align-items: center;
					color: #008800;
					font-weight: bold;
				}
			}
			.wtmsbox{
				padding: 10rpx 0 0 0;
				font-size: 28rpx;
				line-height: 50rpx;
				.qiuz{
					font-weight: bold;
					color: red;
				}
			}
			.tmprbox{
				display: flex;
				align-items: center;
				padding: 10rpx 0 0 0;
				.time{
					color: #999;
					flex: 1;
				}
				.price{
					color: #999;
					font-size: 24rpx;
					.bp{
						font-size: 34rpx;
					}
				}
			}
			.txhy{
				padding: 10rpx 0 0 0;
				&.txhy2{
					display: flex;
					padding-top: 20rpx;
					.jrhy{
						width: auto;
						padding: 0 25rpx;
						&+.jrhy{
							margin-left: 40rpx;
						}
					}
				}
				.hyid{
					font-size: 28rpx;
					color: #e3af2f;
					font-weight: bold;
					&.hyid2{
						color: #333;
					}
				}
				.jrhy{
					width: 180rpx;
					height: 60rpx;
					line-height: 60rpx;
					font-size: 26rpx;
					border-radius: 30rpx;
					text-align: center;
					background: #e3af2f;
					color: #fff;
				}
			}
		}
	}
</style>
